export default {
  data () {
    return {
      // 渲染数据
      goodsList: [],
      pagenum: 1,
      total: 0
    }
  },
  created () {
    this.getGoodsList()
  },
  methods: {
    async getGoodsList (pagenum = 1, query = '') {
      const res = await this.$http.get('/goods', {
        params: {
          query,
          pagenum,
          pagesize: 5
        }
      })
      console.log(res.data)
      this.goodsList = res.data.data.goods
      this.total = res.data.data.total
    },
    currentChange (curPage) {
      this.getGoodsList(curPage)
    }
  }
}
